<?
	class AdminInterface {
		
		
		function AdminInterface($static_config_file_path){
		

			$this->options = get_option('neewee');
			
			add_action('admin_menu', array(&$this, 'admin_menu'));
			add_action('admin_head', array(&$this, 'admin_head'));
			
			
			
			
			
		}
		
		function admin_menu() {
		    add_theme_page('Theme Control Panel', 'NeeWee Settings', 'edit_themes', "themename", array(&$this, 'optionsmenu'));
		}

		  function admin_head() {
		    echo '<link rel="stylesheet" href="'.get_bloginfo('template_url').'/admin/interface.css" type="text/css" media="screen" />';
		  }

		  function optionsmenu() {
			if ($_POST['ss_action'] == 'save') {
			    $this->options["featured_category"] = isset($_POST['cp_featured_article_category']) ? $_POST['cp_featured_article_category'] : -1;
				$this->options["adsense_publisher_id"] = isset($_POST['cp_adsense_publisher_id']) ? $_POST['cp_adsense_publisher_id'] : "";
				$this->options["analytics_id"] = isset($_POST['cp_analytics_id']) ? $_POST['cp_analytics_id'] : "";
				$this->options["feedburner_feed_url"] = isset($_POST['cp_feedburner_feed_url']) ? $_POST['cp_feedburner_feed_url'] : "";
				$this->options["feedburner_email_id"] = isset($_POST['cp_feedburner_email_id']) ? $_POST['cp_feedburner_email_id'] : "";
				$this->options["feedburner_stats"] = isset($_POST['cp_feedburner_stats']) ? 1 : 0;
				$this->options["color_scheme"] = isset($_POST['cp_scheme']) ? $_POST['cp_scheme'] : 'blue';

				if($feedburner_name = eregi_replace("http://feeds.feedburner.com/", "", $this->options["feedburner_feed_url"])) {
					$this->options["feedburner_name"] = $feedburner_name;
				}

			    update_option('neewee', $this->options);

			    echo '<div class="updated fade" id="message"><p>Settings <strong>saved</strong>.</p></div>';

			  }
			/*
			  echo '<form action="" method="post" class="themeform">';
			  echo '<input type="hidden" id="ss_action" name="ss_action" value="save">';
			  echo '<input type="checkbox" name="cp_displayblogtitle" id="cp_displayblogtitle"'.($this->options["display_blog_title"] == 1 ? ' checked' : '').' /><label style="margin-left: 5px;" for="cp_displayblogtitle">Display Blog Title</label><br />';
			  echo 'Blog Title Color: <input class="widefat" style="text-align: right; width: 65px" name="cp_blogtitlecolor" id="cp_blogtitlecolor" type="text" value="'.$this->options["blog_title_color"].'" />';
			  echo '<p class="submit"><input type="submit" value="Save Changes" name="cp_save"/></p>';
			  echo '</form>';
			*/
			require_once(TEMPLATEPATH . '/admin/adminform.php');
		  }
	}
?>